"""
process the command line parameters
"""

def gettrainparamsdic(arglist):
    """
    0 the the python filename
    left is pair of name=value
    """
    tmpdic = {}
    for i in range(1,len(arglist)):
        ws = arglist[i].split("=")
        if ws[0][0] != "-":
            raise Exception("parameter format not right, \
                    name should start with-"+str(ws))
        tmpdic[ws[0][1:]] = ws[1]
    if not tmpdic.has_key("arff"):
        tmpdic['arff'] = "test.arff"
    if not tmpdic.has_key("xsize"):
        tmpdic['xsize'] = 10
    if not tmpdic.has_key("ysize"):
        tmpdic['ysize'] = 10
    if not tmpdic.has_key("maxiter"):
        tmpdic['maxiter'] = 40
    #if not tmpdic.has_key("output"):
    #    tmpdic['output'] = "output.som"
    return tmpdic
